﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.HR
{
    public partial class YeniKartlar : XForm
    {
        public YeniKartlar()
        {
            InitializeComponent();
        }

        private void YeniKartlar_Load(object sender, EventArgs e)
        {
            gridView1.Init("GetYeniKartlar", chkHepsi.Checked);
            gridView1.Columns["UserId"].ColumnEdit = RI(Rp.V_User0);
            gridView1.MakeReadOnly("UserId");
            gridView1.AddSummary();
            gridView1.BestFitColumns();

            btnKaydet.ItemClick += btnKaydet_ItemClick;
            chkHepsi.CheckedChanged += chkHepsi_CheckedChanged;
        }

        void chkHepsi_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Rfrsh();
        }

        private void Rfrsh()
        {
            gridView1.RefreshDataSource("GetYeniKartlar", chkHepsi.Checked);
            gridView1.BestFitColumns();
        }

        void btnKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string xml = gridView1.Serialize();
            ExecuteNonQuery("UpdYeniKartlar", xml);
            Rfrsh();
        }
    }
}
